#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

#define REP(i, x, y) for (auto i = (x), _##i = (y); i < _##i; ++i)
#define PER(i, x, y) for (auto i = (x), _##i = (y); i > _##i; --i)

template<class T=int>
inline void OO(const T &coll, const char *del = ",") {
    copy(coll.begin(), coll.end(), ostream_iterator<decltype(*coll.begin())>(cerr, del));
    cerr << endl;
}

const int maxn = 1e5 + 100;
int a[maxn], dp[maxn], n;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    while (cin >> n) {
        REP(i, 0, n)cin >> a[i];
        fill(dp, dp + n, 1);
        REP(i, 1, n) {
            REP(j, 0, i) {
                if (a[i] <= a[j])
                    dp[i] = max(dp[j] + 1, dp[i]);
            }
        }
        copy(dp,dp+n,ostream_iterator<int>(cerr," "));
        cout<<endl;
        cout << *max_element(dp, dp + n) << endl;
    }
    return 0;
}
